<template>
  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="getTitle" @ok="handleSubmit" :width="800">
    <RenderHtml :text="content"/>
  </BasicModal>
</template>
<script lang="ts" setup>
import {computed, ref} from 'vue';
import RenderHtml from '/@/components/My/RenderHtml.vue';
import {BasicModal, useModalInner} from '/@/components/Modal';

// 声明Emits
const emit = defineEmits(['register']);
const content = ref('')

//表单赋值
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
  content.value = data.content
  setModalProps({ confirmLoading: false });
});
//设置标题
const getTitle = computed(() => '消息内容');
//表单提交事件
async function handleSubmit() {
  try { 
    setModalProps({ confirmLoading: true });
    //关闭弹窗
    closeModal();
  } finally {
    setModalProps({ confirmLoading: false });
  }
}

</script>
